package experiment.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class EncryptionUtil {
	
	 public static  String encryptPasswordMD5(String password) {
	        try {
	            MessageDigest md = MessageDigest.getInstance("MD5");
	 
	            md.update(password.getBytes());
	 
	            byte[] bytes = md.digest();
	            StringBuilder sb = new StringBuilder();
	            for (byte b : bytes) {
	                sb.append(Integer.toHexString((b & 0xFF) | 0x100).substring(1, 3));
	            }
	            return sb.toString();
	        } catch (NoSuchAlgorithmException e) {
	            e.printStackTrace();
	            return null;
	        }
	    }
}
